# backsack problem dynamic programming
value = [1, 6, 18, 22, 28] 
weight = [1, 2, 5, 6, 7]
constain = 13

# vlaue table roll- constain, collum-index of itemt_cz
value_table = []
for i in range(6):
    value_table.append([0]*13)
       
for i in range(0,5):
    for w in range(0,13):
        if weight[i]>w:
            value_table[i+1][w] = value_table[i][w]
        else:
            value_table[i+1][w] = max(value_table[i][w],value[i]+value_table[i][w-weight[i]])

print(value_table)       
pass
# track item